<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>updateDemo</title>
<script type="text/javascript" src="${base}/script/jquery-1.10.2.js"></script>
<script type="text/javascript" src="${base}/script/jquery.form.js"></script>
</head>
<body>
<form action="" method="post" id="form" enctype="multipart/form-data">
名称：<input type="text" name="userName"></br>
email:<input type="text" name="email"></br>
文件:<input type="file" name="file" id="file-upload" ></br>
<input type="button" value="提交" onclick="goSubmit()">
</form>
<script type="text/javascript">
function goSubmit() {
	if ($("#file-upload").val() == "") {
		alert("请选择文件")
		return;
	}
	
	var file = $("#file-upload").val();
	var suffix = file.toLowerCase().substr(file.lastIndexOf("."));
	if (suffix != ".xls" && suffix != ".xlsx" ) {
		alert("选择的文件格式不符，请先下载模板，按照模板中的格式进行上传");
		return  false;
	}
	uploadXlsFile();
}


function uploadXlsFile(){
 	
	 // 准备好Options对象  
	var options = {  
	    url:'${base}/update/updateFile.do',  
	    type:'post',
	    resetForm :true,
	    clearForm:true,
	    dataType:'json',
	    success: function(dataString, status, xhr) { 
	    	try {
	    		
	    	} catch (error) {
	    		
   			}
	    }
	}; 
	$('#form').ajaxSubmit(options); 
}
</script>

</body>
</html>